#!/bin/bash -
#=======================================================================
#
#          FILE: netconsole_monitor_set.sh
#         USAGE: ./netconsole_monitor_set.sh
#   DESCRIPTION: Set netconsole for monitor machine
#  REQUIREMENTS: netconsole
#          BUGS: N/A
#         NOTES: N/A
#        AUTHOR: Ali Ayoub
#         EMAIL: ali@mellanox.com
#       COMPANY: N/A
#       CREATED: 09.17.2010-15:25:49
#      REVISION: 1.0
#=======================================================================

if ( ps -lefc | grep syslog | grep syslogd | grep '\-m 0 \-r \-x' -q);  then
        echo "-I- Already set"
        exit 0
fi


egrep -v '^$|^#|SYSLOGD_OPTIONS=' /etc/sysconfig/syslog > /etc/sysconfig/syslog.new
echo 'SYSLOGD_OPTIONS="-m 0 -r -x"' >> /etc/sysconfig/syslog.new
\cp /etc/sysconfig/syslog /etc/sysconfig/syslog.orig
\mv /etc/sysconfig/syslog.new /etc/sysconfig/syslog
chkconfig syslog on
/etc/init.d/syslog restart
rc=$?

echo "-I- Done [$rc]."
exit $rc
